Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an action and a GitHub workflow to get release notes via GitHub and prepare release content. #16

Merged
merged 10 commits into from
Jun 23, 2022

Conversation

eason9487
Copy link
Member

@eason9487 eason9487 commented Jun 17, 2022

Changes proposed in this Pull Request:

This PR implements part 1 in #15 - 📌 Prepare a release content when a specific branch is created onto the target revision.

  • Move some functions to the utils directory.
  • Add generateReleaseNotes method to RepoTool class.
  • Add a new util getPackageSettings for getting the settings of package.json.
  • Add a new custom GitHub action for getting release notes via a GitHub API, and infer the next version and tag.
  • Add a new GitHub workflow to prepare a new release for the GitHub actions package.
  • Update docs for get-release-notes action and release process.

Before merge:

  • Delete release/actions-demo-1 and release/actions-demo-2 branches.
  • Clean up test branches if any.

Detailed test instructions:

Check simulations on Actions

💡 Since this workflow is not easy to test, I created two simulations to demonstrate the results. And two merged PRs (#11 and #12) were attached to the [actions] changelog: add label for grouping the changelog to match the version level.

  1. The first one shows the initial release - workflow result
    • For the first-time release, it won't bump the versions and will use the version value in package.json as the initial release version number.
      image
    • View the changes committed by the "Prepare New Release" workflow.
  2. The second one simulates the version bumping and the second changelog prepending - workflow result
    • For the subsequent release, it bumps the versions based on the version value in package.json, and increases the version level by matching the level keywords to the changelog content.
    • In this demo, the content has a ### New Features 🎉 heading that matches the minor level. So the next version is 1.1.0.
    • View the changes committed by the "Prepare New Release" workflow to check if the versions were updated.

Test the release preparation by creating the release branch

  1. Create release/actions branch based on this PR. https://github.com/woocommerce/grow/tree/add/prepare-release-action
    2022-06-17 16 24 35
  2. Go to the "Prepare New Release" workflow to see how it goes.

The release/actions-demo-1 and release/actions-demo-2 won't trigger the workflow. They were originally the release/actions branch, and I renamed them to keep the demo results.

Changelog entry

@eason9487 eason9487 requested a review from a team June 17, 2022 09:09
@eason9487 eason9487 self-assigned this Jun 17, 2022
TODAY=$(date '+%Y-%m-%d')
NEXT_VER="${{ steps.get-notes.outputs.next-version }}"
CHANGELOG="${{ steps.get-notes.outputs.release-changelog }}"
CHANGELOG=$(echo "$CHANGELOG" | sed -E 's/\.? by @[^ ]+ in (https:\/\/github\.com\/.+)/. (\1)/')
Copy link
Member

@tomalec tomalec Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚧 If we remove the PR authors and links, I think we should also remove the

## New Contributors

section. (See https://github.com/woorelease-bugs/initial-release/releases/new?tag=1.0.1 fro an example)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outputs.release-changelog output only contains the part of "## What's Changed" heading and its entries. So other contents won't be included. I added output logs in the get-release-notes action by dd0226a. It should be easier to know the actual values of outputs and to use them.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok, now I got it.
/## What's Changed\n([\d\D]+?)(?=\n\n)/i catches all the things before the double line break => before

##New Constributors

Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tool, thanks!
Reviewed the code, and inspected workflow logs - LGTM.

The only comments I have are:

@eason9487
Copy link
Member Author

eason9487 commented Jun 22, 2022

@tomalec, thanks for the review.

I adjusted the config of release notes in fc88a06. By the way, after some tests, the bot accounts like dependabot don't have the [bot] suffix when setting the exclude list in the config.

Could you help with a new round of code reviews?

@eason9487 eason9487 requested a review from tomalec June 22, 2022 03:41
Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) thanks

@eason9487 eason9487 merged commit bf7b9c1 into trunk Jun 23, 2022
@eason9487 eason9487 deleted the add/prepare-release-action branch June 23, 2022 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants